package cn.iocoder.yudao.framework.pay.core.client.impl.pax.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 商品类型
 */
public enum GoodsTypeEnum {
    TANGIBLE_GOODS("01"), // 实物商品
    VIRTUAL_GOODS("02"), // 虚拟商品
    ;

    private final String value;

    GoodsTypeEnum(String value) {
        this.value = value;
    }

    // Jackson deserialization method
    @JsonCreator
    public static GoodsTypeEnum fromValue(String value) {
        for (GoodsTypeEnum status : GoodsTypeEnum.values()) {
            if (status.value.equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid goodsType: " + value);
    }

    // Jackson serialization method
    @JsonValue
    public String getValue() {
        return value;
    }

}
